package com.rfid.dataSync;
import com.rfid.client.LogEvent;
import com.rfid.listener.LogListener;
import com.teatrace.model.Product;
import com.teatrace.service.RFIDDataSyncService;
import com.teatrace.webservice.client.WebServiceUtils;


public class ProductDataSyncListener implements LogListener {
	
	private RFIDDataSyncService service;
	
	public ProductDataSyncListener() {
		service = (RFIDDataSyncService) WebServiceUtils.getService("rfidDataSync");
	}

	@Override
	public void onLogEvent(LogEvent e) {
		String name = e.getName();
		Product product = new Product();
		product.setProductNum(e.getProductNum());
		product.setName(name);
		service.syncProductInfo(product);
	}

}
